package com.anxin.mybatisplus.controller;

import com.anxin.mybatisplus.domain.entity.Employee;
import com.anxin.mybatisplus.service.IEmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *  Spring MVC  转发  注解RestController
 *
 *
 * @author anxinr
 */
@Slf4j
@RestController
@RequestMapping("/mybatis/plus/test")
public class LearnController {

    /**参考mapper注释*/
    @Autowired
    private IEmployeeService employeeService ;

    @GetMapping("/get")
    public List<Employee> get(){
        List<Employee> list = employeeService.getEmployeeByName() ;
        return list ;
    }

    @GetMapping("/update")
    public String update(){
        employeeService.updateEmployee() ;
        return "修改成功" ;
    }
}
